package com.star.area.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.star.area.api.AreaServieApi;
import com.star.area.dao.model.CountryAssociatedInfoEntity;
import com.star.area.modal.Area;
import com.star.area.service.CountryAssociatedInfoService;

@ConfigurationProperties("")
@Component
@Service(interfaceClass = AreaServieApi.class, timeout = 60000)
public class AreaServiceImpl implements AreaServieApi {
	@Autowired
	private CountryAssociatedInfoService countryAssociatedInfoService;
	@Override
	public Area getAreaById(Long areaID) {
		CountryAssociatedInfoEntity counrtyInfo = countryAssociatedInfoService.getByFKCountryId(areaID);
		Area area = convertToArea(null,counrtyInfo);
		return area;
	}
	private Area convertToArea(Object country,CountryAssociatedInfoEntity countryInfo) {
		Area area = new Area();
		if(null!=country) {
		}
		if(null!=countryInfo) {
			area.setCode(countryInfo.getCode());
			area.setId(countryInfo.getId());
			area.setCountryNo(countryInfo.getCurrencyName());
		}
		return area;
	}
}
